//
//  BaseTableViewCell.m
//  OverseasOnlineShopping
//
//  Created by 唐先才 on 16/3/7.
//  Copyright © 2016年 唐先才. All rights reserved.
//

#import "BaseTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface BaseTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *mallLab;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *priceLab;
@property (weak, nonatomic) IBOutlet UILabel *countLab;

@end

@implementation BaseTableViewCell

- (void)setModel:(TxcModel *)model {
    _model = model;
    [_iconView sd_setImageWithURL:[NSURL URLWithString:model.MainImage]];
    _mallLab.text = [NSString stringWithFormat:@"%@       %@", model.MallName, model.InfoTime];
    _titleLab.text = model.InfoTitle;
    _priceLab.text = model.CommodityPrice;
    _countLab.text = [NSString stringWithFormat:@"%@", model.IsGood];
}

+ (UITableViewCell *)configCellWith: (UITableView *)tableView indexPath:(NSIndexPath *)indexPath dataArray: (NSMutableArray *)dataArray {
    BaseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"baseTableViewCell"];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"BaseTableViewCell" owner:self options:nil] lastObject];
    }
    if (dataArray.count > 0 ) {
        cell.model = dataArray[indexPath.row];
    }
    return cell;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
